<!DOCTYPE HTML>
<html>
<head>
    <link rel="stylesheet" href="/opebs/css/bootstrap.min.css">
    <link rel="stylesheet" href="/opebs/css/bootstrap-select.css">
    <script src="/opebs/js/jquery.min.js"></script>
    <script src="/opebs/js/bootstrap.min.js"></script>
    <script src="/opebs/js/bootstrap-select.js"></script>
    <script src="/lib/jquery.form.js"></script>
    <script type="text/javascript" src="/lib/layer/2.4/layer.js"></script>
    <#include "/common/h-ui-base-css.html">
    <#include "/common/validation-js.html">
    <link href="/lib/ueditor/themes/css/umeditor.css" type="text/css" rel="stylesheet">
    <script type="text/javascript" charset="utf-8" src="/lib/ueditor/js/umeditor.config.js"></script>
    <script type="text/javascript" charset="utf-8" src="/lib/ueditor/js/editor_api.js"></script>
    <script type="text/javascript" src="/lib/ueditor/lang/zh-cn/zh-cn.js"></script>

    <link rel="stylesheet" href="/opebs/date/css/bootstrap-datetimepicker.min.css">
    <script src="/opebs/date/js/bootstrap-datetimepicker.min.js"></script>

</head>
<body>
<article class="page-container">
    <form class="form form-horizontal" id="form-tuichu-add">
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>项目名称：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="${project.proName!}" style="background-color: #8eaf84" placeholder=""  readonly>
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">项目退出时间：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="${project.proTuichuTime!}" id="proTuichuTime" name="proTuichuTime">
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">项目退出方式：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <select id="proOutWay" name="proOutWay" class="selectpicker form-control"  data-live-search="true" style="width: 100%;height: 100%">
                    <option data-tokens="" value="-1">请选择</option>
                    <#if outWayList??>
                        <#list outWayList as m>
                             <option data-tokens="${m.key}" value="${m.key}" <#if project.proOutWay??><#if m.key==project.proOutWay>selected</#if></#if>>${m.text}</option>
                        </#list>
                    </#if>
                </select>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">股数：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="${project.assignmentNumber!}" placeholder="" id="assignmentNumber" name="assignmentNumber">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">平均价格：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="${project.averagePrice!}" placeholder="" id="averagePrice" name="averagePrice">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">总计：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="${project.totalPrice!}" placeholder="" id="totalPrice" name="totalPrice">
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">项目总结：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="${project.proOutContent!}" placeholder="" id="proOutContent" name="proOutContent">
                </div>
                </div>

        <#--<div class="row cl">-->
            <#--<label class="form-label col-xs-4 col-sm-2">项目总结：</label>-->
            <#--<div class="formControls col-xs-8 col-sm-9">-->
                <#--<script type="text/plain" id="myEditor" style="width:98%;height:240px;">${project.proOutContent!}</script>-->
            <#--</div>-->
        <#--</div>-->

        <div class="row cl">
                <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
                    <button class="btn btn-primary radius" type="submit"><i class="Hui-iconfont">&#xe632;</i> 保存并提交审核</button>
                    <button onClick="removeIframe();" class="btn btn-default radius" type="button">&nbsp;&nbsp;取消&nbsp;&nbsp;</button>
                </div>
        </div>
     </form>
</article>

 <script type="text/javascript">
        // var um = UM.getEditor('myEditor',{
        //     //这里可以选择自己需要的工具按钮名称,此处仅选择如下七个
        //     toolbar:['fullscreen source undo redo bold italic underline'],
        //     //focus时自动清空初始化时的内容
        //     autoClearinitialContent:false,
        //     //关闭字数统计
        //     wordCount:false,
        //     //关闭elementPath
        //     elementPathEnabled:false,
        //     //默认的编辑区域高度
        //     initialFrameHeight:300
        //     //更多其他参数，请参考umeditor.config.js中的配置项
        // });
        $("#form-tuichu-add").validate({
            rules:{
                totalPrice:{
                    required:true,
                    number:true
                },
                totalPrice:{
                    required:true,
                    isSelected:true
                }
            },
            onkeyup:false,
            focusCleanup:true,
            success:"valid",
            submitHandler:function(form){
                var id = ${project.id};
                var assignmentNumber = $('#assignmentNumber').val();
                var averagePrice = $('#averagePrice').val();
                var totalPrice = $('#totalPrice').val();
                var proOutWay = $('#proOutWay').val();
                var proTuichuTime = $('#proTuichuTime').val()
                // var content = um.getPlainTxt();
                var content = $('#proOutContent').val()
                $(form).ajaxSubmit({
                    type: 'post',
                    url: "/project-ins-upd-del/"+id ,
                    data :{assignmentNumber:assignmentNumber,averagePrice:averagePrice,totalPrice:totalPrice,proOutWay:proOutWay,content:content,proTuichuTime:proTuichuTime},
                    async:false,
                    success: function(data){
                        layer.msg('添加成功!',{icon:1,time:1000});
                        var index = parent.layer.getFrameIndex(window.name);
                        var handler = '/project-list/5/1/20';
                        parent.$('#project_table').datagrid('options').url = handler;
                        parent.$('#project_table').datagrid('reload');
                        parent.layer.close(index);
                    },
                    error: function(XmlHttpRequest, textStatus, errorThrown){
                        layer.msg('error!',{icon:1,time:1000});
                    }
                });

            }
        });
        jQuery.validator.addMethod("isSelected", function(value, element) {
            var flag = this.optional(element) || ( value!=-1 );
            if(value==-1)
                layer.msg("请选择")
            return flag;
        }, "");

        </script>
                <script type="text/javascript">
                    $(function(){
                        $("#proTuichuTime").datetimepicker({
                            format:'yyyy-mm-dd',  //格式  如果只有yyyy-mm-dd那就是0000-00-00
                            autoclose:true,//选择后是否自动关闭
                            minView:2,//最精准的时间选择为日期  0-分 1-时 2-日 3-月
                            language:  'zh-CN', //中文
                            weekStart: 1, //一周从星期几开始
                            todayBtn:  1,
                            autoclose: 1,
                            todayHighlight: 1,
                            startView: 2,
                            forceParse: 0,
                            // daysOfWeekDisabled:"1,2,3", //一周的周几不能选 格式为"1,2,3"  数组格式也行
                            todayBtn : true,  //在底部是否显示今天
                            todayHighlight :true, //今天是否高亮显示
                            keyboardNavigation:true, //方向图标改变日期  必须要有img文件夹 里面存放图标
                            showMeridian:false,  //是否出现 上下午
                            initialDate:new Date()
                            //startDate: "2017-01-01" //日期开始时间 也可以是new Date()只能选择以后的时间
                        }).on("changeDate",function(){
                            var start = $("#start").val();
                        });

                    });
                </script>
</body>
</html>